package cn.hahah.module.blog.dal.mysql.userlike;

import java.util.*;

import cn.hahah.framework.common.pojo.PageResult;
import cn.hahah.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.hahah.framework.mybatis.core.mapper.BaseMapperX;
import cn.hahah.module.blog.dal.dataobject.userlike.UserLikeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.hahah.module.blog.controller.admin.userlike.vo.*;

/**
 * 用户点赞 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface UserLikeMapper extends BaseMapperX<UserLikeDO> {

    default PageResult<UserLikeDO> selectPage(UserLikePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserLikeDO>()
                .eqIfPresent(UserLikeDO::getArticleId, reqVO.getArticleId())
                .eqIfPresent(UserLikeDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UserLikeDO::getIsLike, reqVO.getIsLike())
                .betweenIfPresent(UserLikeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserLikeDO::getId));
    }

}